package com.example.demo.service.impl;

import com.example.demo.service.OrderService;
import com.example.demo.model.Order;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author
 * 订单服务实现类
 */
@Service
@Slf4j
public class OrderServiceImpl implements OrderService {

    @Override
    public Order getOrderById(Integer id) {
        return Order.builder().id(123456).name("订单").build();
    }

    @Async("MyExecutor")
    @Override
    public void insertOrder() throws InterruptedException {
/*        new Thread(new Runnable() {
            @Override
            public void run() {
                log.info("子线程打印");
            }
        }).start();*/
        log.info("正在执行插入user");
    }

}